<%@ page pageEncoding="utf-8" isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>校园超市管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/style.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/js/bootstrap/css/bootstrap.min.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jsp/js/jQuery1.11.1.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
    <%--  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.pagination.js"></script>--%>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var  loginOut;
        var baocun;
        $(function () {
            baocun = function updateuser() {
                $.ajax({
                    url: "${pageContext.request.contextPath}/userupdate",
                    type: "post",
                    data: $("#form1").serialize(),
                    statusCode: {
                        403: function() {
                            $.messager.alert("温馨提示","无权访问","error");
                        }
                    },
                    success: function (data) {
                        if (data.data == 1) {
                            $.messager.alert("温馨提示", "修改成功", "info");
                            setTimeout(function () {
                                location.href = "${pageContext.request.contextPath}/jsp/userList.jsp";
                            }, 2000);
                        }
                        else {
                            $.messager.alert("温馨提示", "修改失败", "error");
                        }
                    }
                });
            }

            loginOut=function userLoginOut() {
                $.messager.confirm("温馨提示", "确定要退出吗？", function (r) {
                    if (r) {
                        location.href="${pageContext.request.contextPath}/loginout";
                    } else {
                        return false;
                    }

                });
            }
        });
    </script>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>校园超市管理系统</h1>

    <div class="publicHeaderR">
        <p><span>您好！</span><span style="color: #fff21b">${keyword} ${login}</span> , 欢迎你！</p>
        <%--<a href="${pageContext.request.contextPath}/loginout">退出</a>--%>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2">
            <span class="span_gn">功能列表</span>
        </h2>
        <nav>
            <ul class="list">
                <li><a href="${pageContext.request.contextPath}/jsp/productList.jsp">商品管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/billList.jsp">订单管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/providerList.jsp">供应商管理</a></li>
                <li id="active"><a href="${pageContext.request.contextPath}/showUserList">用户管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/password.jsp">密码修改</a></li>
                <li><a onclick="loginOut()">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户修改页面</span>
        </div>
        <div class="providerAdd">
            <form action="#" id="form1">
                <input type="hidden" name="id" value="${userInfo.id}"/>
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div>
                    <label for="userName">用户名称：</label>
                    <input type="text" name="userName" id="userName" placeholder="韩露" value="${userInfo.userName}"/>
                    <span>*</span>
                </div>

                <div>
                    <label>用户性别：</label>

                    <select name="gender">
                        <c:if test="${userInfo.gender==1}">
                            <option value="1" selected="selected">男</option>
                            <option value="2">女</option>
                        </c:if>
                        <c:if test="${userInfo.gender==2}">
                            <option value="1">男</option>
                            <option value="2" selected="selected">女</option>
                        </c:if>
                    </select>
                </div>
                <div>
                    <label for="data">出生日期：</label>
                    <input type="date" name="birthday" id="data" placeholder="2016年2月1日" value="${format}"/>
                    <span>*</span>
                </div>
                <div>
                    <label for="userphone">用户电话：</label>
                    <input type="text" name="phone" id="userphone" placeholder="13533667897" value="${userInfo.phone}"/>
                    <span>*</span>
                </div>
                <div>
                    <label for="userAddress">用户地址：</label>
                    <input type="text" name="address" id="userAddress" placeholder="北京" value="${userInfo.address}"/>
                </div>
                <div>
                    <label>用户类别：</label>
                    <c:if test="${userInfo.userRole==1}">
                        <input type="radio" name="userRole" value="1" checked/>管理员
                        <input type="radio" name="userRole" value="2"/>经理
                        <input type="radio" name="userRole" value="3"/>普通用户
                    </c:if>
                    <c:if test="${userInfo.userRole==2}">
                        <input type="radio" name="userRole" value="1"/>管理员
                        <input type="radio" name="userRole" value="2" checked/>经理
                        <input type="radio" name="userRole" value="3"/>普通用户
                    </c:if>
                    <c:if test="${userInfo.userRole==3}">
                        <input type="radio" name="userRole" value="1"/>管理员
                        <input type="radio" name="userRole" value="2"/>经理
                        <input type="radio" name="userRole" value="3" checked/>普通用户
                    </c:if>
                </div>
                <div class="providerAddBtn">
                    <!--<a href="#">保存</a>-->
                    <!--<a href="userList.jsp">返回</a>-->
                    <input type="button" value="保存" onclick="baocun()"/>
                    <input type="button" value="返回" onclick="history.back(-1)"/>
                </div>
            </form>
        </div>

    </div>
</section>
<footer class="footer">
    版权归本超市所有
</footer>
<script src="${pageContext.request.contextPath}/jsp/js/time.js"></script>

</body>
</html>